 

IF EXISTS(SELECT Name FROM sysobjects where type = 'U' AND name = 'CSVTest')
BEGIN
DROP TABLE CSVTest -- if CSVTable already exists, drop it

END

CREATE TABLE CSVTest -- create table
(ID INT,
FirstName VARCHAR(40),
LastName VARCHAR(40),
BirthDate SMALLDATETIME)

GO



--Bulk Insert from the test file
BULK
INSERT CSVTest -- destination of the table
FROM 'C:\Inetpub\wwwroot\server\testData.txt' -- name of the import file; Note: notice the directory. this script will work only on the remote desktop
WITH
(
FIELDTERMINATOR = ',', -- character that delimits cells
ROWTERMINATOR = '\n' -- character that delimits rows
)
GO
